package service

import (
	"fmt"
	"model"

	"github.com/jinzhu/gorm"
	_ "github.com/jinzhu/gorm/dialects/mysql"
)

type NoticeService struct {
}

func init() {
	db, err := gorm.Open("mysql", "swd:swd12345@tcp(120.27.17.206:3306)/bigdata1?charset=utf8&parseTime=True&loc=Local")
	if err != nil {
		fmt.Println("connection error!" + err.Error())
	}
	defer db.Close()
}

func (notice NoticeService) AddNotice(item *model.Notice) {
	//db.NewRecord(item)
	db.Create(&item)
}
